/*
var adminLottery = function() {

};
adminLottery.prototype = {};

adminLottery.prototype.init = function(game, rule) {
    Lottery.switchGame(game);
    var f = function(list) {
        var map = rule.map;
        for (var k in list) {
            if (isEmpty(map[k])) {
                console.log("不存在的类型", k);
                continue;
            }
            if (list[k].value)
                map[k].rate = list[k].value;
            if (list[k].back)
                map[k].back = list[k].back;
            if (list[k].min)
                map[k].min = list[k].min;
            if (list[k].max)
                map[k].max = list[k].max;
        }

        // 更新赔率信息
        var arr = $(".rate input");
        var arr2 = $(".lottery-item label");
        var arr3 = $(".back input");
        for (var i = 0; i < arr.length; i++) {
            var k = $(arr2[i]).html();
            if (!map[k]) {
                console.log(k);
                continue;
            }
            $(arr[i]).val(map[k].rate);
            if (!map[k].back) $(arr3[i]).val(0);
            else $(arr3[i]).val(parseFloat(map[k].back) * 100);
        }
    };
    Lottery.refresh_rate(f);
    f([]);

    $(".save").click(function() {
        // 保存赔率
        var data = {};
        var arr = $(".rate input");
        var arr2 = $(".lottery-item label");
        var arr3 = $(".back input");
        for (var i = 0; i < arr.length; i++) {
            var k = $(arr2[i]).html();
            data[k] = $(arr[i]).val();
        }
        startLoading();
        console.log('新的赔率', data);
        CMD.lottery_rate_save(game, data, function() {
            stopLoading();
            alert2("保存赔率成功。");
        });

        data = {};
        for (var i = 0; i < arr.length; i++) {
            var k = $(arr2[i]).html();
            data[k] = parseFloat($(arr3[i]).val()) / 100;
        }
        console.log('新的返水', data);
        CMD.lottery_back_save(game, data, function() {
            stopLoading();
        });
    });
};

adminLottery.prototype.add = function(key, title, container) {
    var t = '<div class="lottery-item">' +
            '    <div class="rate am-input-group">' +
            '        <span class="am-input-group-label">__title__</span>' +
            '        <input type="text" class="am-form-field" placeholder="赔率" value="1" /></div>' +
            '    <div class="back am-input-group"><input type="text" class="am-form-field" placeholder="返水" value="0" /><span class="am-input-group-label">%</span></div>' +
            '    <div class="clear" style="display: none"><label>__key__</label></div>' +
            '</div>';
    t = t.replace(/__title__/g, title);
    t = t.replace(/__key__/g, key);

    var td = $("<td></td>");
    td.append(t);
    container.append(td);
}

adminLottery.prototype.add2 = function(key, title, rate, container) {
    var t = '<div class="lottery-item">' +
            '    <div class="rate am-input-group">' +
            '        <span class="am-input-group-label">__title__</span>' +
            '        <input type="text" class="am-form-field" placeholder="赔率" value="__rate__" /></div>' +
            '    <div class="back am-input-group"><input type="text" class="am-form-field" placeholder="返水" value="0" /><span class="am-input-group-label">%</span></div>' +
            '    <div class="clear" style="display: none"><label>__key__</label></div>' +
            '</div>';
    t = t.replace(/__title__/g, title);
    t = t.replace(/__key__/g, key);
    t = t.replace(/__rate__/g, rate);

    var td = $("<td></td>");
    td.append(t);
    container.append(td);
}

window.AdminLottery = new adminLottery();
*/